<?php
namespace app\api\controller\service;

use app\common\controller\Api;

/**
 * 首页接口
 */
class Thumb extends Api
{
    protected $noNeedLogin = ['getList', 'getText'];
    protected $noNeedRight = ['*'];

    /**
     * 首页轮播图
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getList()
    {
        $list = model('app\api\model\service\Thumb')
            ->field('image,type,config_text_id,goods_id,jump_id')
            ->where(['state'=>1])
            ->order('id desc')
            ->select();
        foreach ($list as $key=>$val)
        {
            $list[$key]['jump'] = $val['type'] == 3?\app\api\model\service\Jump::where(['id'=>$val['jump_id']])->value('url'):'';
        }
        $this->success('信息返回成功',$list);
    }



}
